#include<atomic>
#include<thread>
#include<mutex>
#include<iostream>
using namespace std;

class Instance {
	static shared_ptr<Instance> instance;
public:
	static Instance* getInstance() {
		static once_flag flag;
		call_once(flag, []() {Instance::instance.reset(new Instance()); });
		return instance.get();
	}
};
shared_ptr<Instance> Instance::instance;

union Test {
	int a;
	char c;
};

int main() {
	Test t;
	t.c = 1;
	std::cout << t.a << std::endl;

	char data[] = { 0x01,0x02,0x03,0x04 };
	int* num = (int*)data;
	std::cout << *num << std::endl;
	cout << Instance::getInstance() << endl;
	cout << Instance::getInstance() << endl;
	cout << Instance::getInstance() << endl;
}